<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>收藏中心</title>
<%@ include file="/page/pc/include.jsp"%>
</head>
<script type="text/javascript">
	/**
	 * 取消收藏
	 */
	function doDelFavorite(favoriteId) {
	    $.ajax({
			type : "post",
			url : rootPath + '/wx/favorite/doDelFavorite',
			data : {
			    idArrStr : favoriteId
			},
			datatype : "json",
			success : function(json) {
				if (json.code == '1') {
					layer.msg(json.msg,{time:3000});
					$("li[favorite='"+favoriteId+"']").remove();
				} else {
					layer.msg(json.msg,{time:3000});
				}
			},
			error : function() {
				layer.msg('暂时无法取消收藏',{time:1000});
			}
		});
	}
	</script>
<body>
	<div class="wrap">
		<jsp:include page="../_my_header.jsp" />
		<div class="site_wrap18">
			<div class="site_wrap18_con">
				<div class="main">
					<jsp:include page="../_my_left.jsp" />
					<div class="rightitem">
						<div class="all_prdlist">
							<div class="all_prdlist_con">
								<div class="hd">
									<h3>全部商品</h3>
								</div>
								<div class="bd">
									<form action="<%=basePath%>/pc/my/favorite?tmpNumPerPage=8" name="favoriteProductForm" id="favoriteProductForm" method="post">
										<div class="prd_list1">
											<c:choose>
												<c:when test="${empty favoriteList }">
													<div class="noresult" style="text-align: center;height:285px;">
														<p>
															<i><img src="<%=basePath%>/statics_wx/images/icon_nofav.png" style="height:100px;width:100px;" /></i> 
															<br>
															<br>
															<br>
															<span>您还没有收藏商品哦~</span>
														</p>
													</div>
												</c:when>
												<c:otherwise>
													<ul>
														<c:forEach items="${favoriteList }" var="favorite">
															<li favorite="${favorite.id}">
																<div class="box23">
																	<div class="pic">
																		<div class="del_fav">
																			<a href="javascript:void(0);" onclick="doDelFavorite('${favorite.id}');" title="取消收藏"></a>
																		</div>
																		<a target="_blank" href="<%=basePath%>/pc/product/detail?productId=${favorite.productId}">
																			<img src="${imgRootURL }${favorite.productImg}" onerror="this.src='<%=basePath%>/statics/images/default.jpg';"/>
																		</a>
																	</div>
																	<div class="item-info">
																		<h2>
																			<a target="_blank" href="<%=basePath%>/pc/product/detail?productId=${favorite.productId}">${favorite.productName }</a>
																		</h2>
																		<%-- <h3>
																			<em>¥</em>
																			<fmt:formatNumber type="number" value="${favorite.productPrice }" pattern="0.00" maxFractionDigits="2" />
																		</h3> --%>
																		<p>
																			<a target="_blank" href="<%=basePath%>/pc/product/detail?productId=${favorite.productId}">
																				<i></i><span>立即购买</span>
																			</a>
																		</p>
																	</div>
																</div>
															</li>
														</c:forEach>
													</ul>
													<jx:paging formID="favoriteProductForm" isShowJumpToButton="true" numPerPage="8" isShowpageCount="true"></jx:paging>
												</c:otherwise>
											</c:choose>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div>
		<!---网站底部开始-->
		<jsp:include page="../../footer.jsp?showQaFlag=0" />
		<!---网站底部结束-->
	</div>
</body>
</html>